package com.common;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

/**
 * 功能
 *
 * @author libin
 * @since 2.3.0
 */
public class Test {
    public static void main(String[] args) {
        // 1.IO读取文件
        // 2.POI获取csv各列数据
        // 3.数据存入List集合
        List<Students> list = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            Students students = new Students(String.valueOf(i) + "==" + UUID.randomUUID(), i + 10, i);
            list.add(students);
        }
        // 4.利用stream流进行一个score由高到低排序
        List<Students> collect = list.stream().sorted(Comparator.comparing(Students::getScore).reversed()).collect(Collectors.toList());
        // 5.循环十次输出前十用户ID
        for (int i = 0; i < 10; i++) {
            System.out.println(collect.get(i).getId());
        }
    }
}